package com.spzx.cart.api.factory;

import com.spzx.cart.api.domain.CartInfo;
import com.spzx.cart.api.service.RemoteCartService;
import com.spzx.common.core.domain.R;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

public class RemoteCartFallbackFactory implements FallbackFactory<RemoteCartService> {
    @Override
    public RemoteCartService create(Throwable cause) {
        return new RemoteCartService() {
            @Override
            public R<List<CartInfo>> getCheckedCartInfo(Long userId, String source) {
                return R.fail("远程调用购物车微服务获取已选中的购物项失败" + cause.getMessage());
            }

            @Override
            public R<?> clearCheckedCartInfo(Long userId, String source) {
                return R.fail("远程调用购物车微服务清除已选中的购物项失败" + cause.getMessage());
            }
        };
    }
}
